<?php

function loginCss() {
    echo '<link rel="stylesheet" type="text/css" href="../css/doc.css" />';
}

function loginJs() {
    echo '<script type="text/javascript">
            function sendLogin(){
                var user=document.getElementById("user_login").value;
                var pass=document.getElementById("pass_login").value;
                if(user!="" && pass!=""){
                    document.getElementById("user_pass_login").value = user+String.fromCharCode(29)+md5(pass);
                    return true;
                }else{
                    return false;
                }
            }
        </script>';
}

function loginHtml() {
    echo '<br/>';
    if (isset($_SESSION['usu_usuario_16856'])) {
        $form_user = '<form name="form_unlogin" id="form_unlogin" method="POST" action="apps/components/autenticador.php">
                <fieldset>
                    <legend>Usuario:</legend>
                    <table>
                        <tr>
                            <td>
                                ' . $_SESSION['usu_usuario_16856'] . '
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input class="button" type="submit" value="Cerrar Sesi&oacute;n" />
                                <input name="user_unlogin" type="hidden" value="si"/>
                            </td>
                        </tr>';
        /*if (isset ($_SESSION['usu_rol_id'])){
            if(strtolower($_SESSION['usu_rol_id'])==strtolower($GLOBALS['ROLES']['ADMINISTRADOR'])){
            $form_user .= '<tfoot>
                            <tr>
                                <td class="pie">
                                    <img src="imagenes/point_off.png" width="10" height="10" alt="ir a"/>
                                    <a href ="contenido/componentes/registro.php" target ="showframe">Registrar usuario</a> 
                                </td>
                            </tr>
                            <tr>
                                <td class="pie">
                                    <img src="imagenes/point_off.png" width="10" height="10" alt="ir a"/>
                                    <a href ="contenido/tematicas.php" target ="showframe">Tem&aacute;ticas de columnas</a> 
                                </td>
                            </tr>
                            <tr>
                                <td class="pie">
                                    <img src="imagenes/point_off.png" width="10" height="10" alt="ir a"/>
                                    <a href ="" target ="showframe">Rubros de Clasificados</a> 
                                </td>
                            </tr>
                            <tr>
                                <td class="pie">
                                    <img src="imagenes/point_off.png" width="10" height="10" alt="ir a"/>
                                    <a href ="contenido/publicidades.php" target ="showframe">Publicidades</a> 
                                </td>
                            </tr>
                        </tfoot>';
            }
        }*/
        $form_user .= '</table>
                </fieldset>
            </form>';
        echo $form_user;
    } else {
        if (isset($_SESSION['error_login'])) {
            echo '<table class="err_inputs"><tr><td>' . $_SESSION['error_login'] .
                ' </td></tr></table>';
        }
        echo '<form name="form_login" method="POST" action="apps/components/autenticador.php" onsubmit="return sendLogin()">
        <table cellspacing="0" cellpadding="0">
            <thead>
                <tr>
                    <td class="tit_sup">
                        Login
                    </td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <table cellspacing="0" cellpadding="0">
                            <tr>
                                <td>
                                    Usuario: 
                                </td>
                                <td>
                                    <input type="text" value="" maxlength="60" size="18" id="user_login"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Clave: 
                                </td>
                                <td>
                                    <input type="password" value="" maxlength="9" size="18" id="pass_login"/>
                                </td>
                            </tr>
                            <tr>
                                <td align="right" colspan="2">
                                    <input class="button" type="submit" value="Iniciar Sesi&oacute;n" name="conectar" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </tbody>
        </table>
        <input name="user_pass_login" id="user_pass_login" type="hidden" value=""/> 
    </form>';
        session_destroy();
    }
}
?>